# -*- coding: utf-8 -*-
"""
Date: 2021-12-06
Author: J z
"""
import sys

from framework.firefly_dc import server_dc

reload(sys)
sys.setdefaultencoding('utf8')

import argparse

from flask import Flask

application = Flask('app')


def parse_args():
    parser = argparse.ArgumentParser(description='Game Server Starter')
    parser.add_argument('--webport', help='Listen Http Port', type=int,
                        default=33333)
    return parser.parse_args()


def prepare_for_start():
    """
    启动服务器的初始化工作
    """
    server_dc.configure_server(application=application, config=None)
    server_dc.start()


prepare_for_start()


if __name__ == "__main__":
    run_args = parse_args()
    application.run(host='0.0.0.0', port=run_args.webport, debug=False)